<%@ page import="br.com.qualityempresa.seguranca.Usuario"%>
<%@ page import="br.com.qualityempresa.seguranca.Perfil"%>
<!DOCTYPE html>
<html>
<head>
<meta name="layout" content="main">
<g:set var="entityName" value="${message(code: 'usuario.label', default: 'Usuario')}" />
<title>
	Quality Empresa -
	<g:message code="default.show.label" args="[entityName]" />
</title>
</head>

<body screen_capture_injected="true">

	<ul class="nav nav-pills">
		<g:permissao devePossuir="true" controles="usuario" acoes="list">
			<li>
				<g:link class="list" action="list">
					<i class="icon-list-alt"></i>
					<g:message code="default.list.label" args="[entityName]" />
				</g:link>
			</li>
		</g:permissao>
		<li class="divider-vertical"></li>
		<g:permissao devePossuir="true" controles="usuario" acoes="create">
			<li>
				<g:link action="create">
					<i class="icon-file"></i>
					<g:message code="default.add.label" args="[entityName]" />
				</g:link>
			</li>
		</g:permissao>
	</ul>

	<mensagem:renderizar mensagem="${flash}" />

	<h2>
		<g:message code="default.show.label" args="[entityName]" />
	</h2>

	<div class="row-fluid">

		<g:if test="${usuarioInstance?.nome}">
			<div class="span3">
				<p class="muted">
					<g:message code="usuario.nome.label" default="Nome" />
				</p>

				<p>
					<strong><g:fieldValue bean="${usuarioInstance}" field="nome" /></strong>
				</p>
			</div>
		</g:if>

		<g:if test="${usuarioInstance?.email}">
			<div class="span3">
				<p class="muted">
					<g:message code="usuario.email.label" default="Email" />
				</p>

				<p>
					<strong><g:fieldValue bean="${usuarioInstance}" field="email" /></strong>
				</p>
			</div>
		</g:if>

	</div>

	<div class="row-fluid">

		<g:if test="${usuarioInstance?.perfil}">
			<div class="span3">
				<p class="muted">
					<g:message code="usuario.perfil.label" default="Perfil" />
				</p>
				<p>
					<strong><g:fieldValue bean="${usuarioInstance}" field="perfil.nome" /></strong>
				</P>
			</div>
		</g:if>

		<g:if test="${usuarioInstance?.ativo}">
			<div class="span3">
				<p class="muted">
					<g:message code="usuario.ativo.label" default="Ativo" />
				</p>

				<p>
					<strong><g:formatBoolean boolean="${usuarioInstance?.ativo}" /></strong>
				</p>
			</div>
		</g:if>

	</div>

	<div class="row-fluid">

		<g:if test="${usuarioInstance?.ultimoAcesso}">
			<div class="span3">
				<p class="muted">
					<g:message code="usuario.ultimoAcesso.label" default="Ultimo Acesso" />
				</p>

				<p>
					<strong><g:formatDate date="${usuarioInstance?.ultimoAcesso}" format="dd/MM/yyyy HH:mm" /></strong>
				</p>
			</div>
		</g:if>

	</div>

	<g:form method="post" action="delete">
		<div class="control-group">
			<div class="controls">
				<g:hiddenField name="id" value="${usuarioInstance?.id}" />
				<g:hiddenField name="perfil.id" value="${usuarioInstance?.perfil?.id}" />
				<g:if test="${autenticacaoUtils.isUsuarioAutenticado(usuarioInstance) || autorizacaoUtils.verificarPermissao('usuario','edit')}">
					<g:link class="btn" action="edit" id="${usuarioInstance?.id}">
						<i class="icon-pencil"></i>
						<g:message code="default.button.edit.label" />
					</g:link>
				</g:if>
				<g:permissao devePossuir="true" controles="usuario" acoes="delete">
					<button type="submit" class="btn" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');">
						<i class="icon-trash"></i>
						<g:message code="default.button.delete.label" />
					</button>
				</g:permissao>
			</div>
		</div>
	</g:form>

</body>
</html>
